<%@page isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<c:set var="fieldRequired"><spring:message code="validation.field.required"/></c:set>
<c:set var="emailInvalid"><spring:message code="validation.email.invalid"/></c:set>
<c:set var="emailTaken"><spring:message code="validation.email.taken"/></c:set>

<script type="text/javascript">
	$().ready(function() {
		$("#registerSupporter").validate({
			rules: {
				firstName: {
					required: true					
				},
				lastName: {
					required: true
				},
				email: {
					required: true,
					email: true,
					remote: "/validation/user/email.do"
				},
				password: {
					required: true
				},
				confirm: {
					required: true,
					equalTo: "#password"
				},
			},
			messages: {
				firstName: {
					required: "${fieldRequired}"
				},
				lastName: {
					required: "${fieldRequired}"
				},
				email: {
					required: "${fieldRequired}",
					email: "${emailInvalid}",
					remote: "${emailTaken}"
				},
				password: {
					required: "${fieldRequired}"					
				},
				confirm: {
					required: "${fieldRequired}"
				},
			}
		});		
	});
</script>	

<div style="padding:10px">
	<div id="form">
		<span class="title"><spring:message code="register.supporter.title"/></span>
		<form:form method="post" commandName="supporter" id="registerSupporter" name="registerSupporter" action="${formURL}" enctype="multipart/form-data">
			<table class="tableForm">
				<tr>
					<td><label><spring:message code="form.first.name"/></label></td>
					<td><form:input path="firstName" id="firstName" size="23"/></td>
				</tr>
				<tr>
					<td><label><spring:message code="form.last.name"/></label></td>
					<td><form:input path="lastName" id="lastName" size="23"/></td>
				</tr>
				<tr>
					<td><label><spring:message code="form.email"/></label></td>
					<td><form:input path="email" id="email" size="23"/></td>
				</tr>
				<tr>
					<td><label><spring:message code="form.password"/></label></td>
					<td><form:password path="password" id="password" size="23" title="<spring:message code='privacy.footnote'/>"/></td>
				</tr>
				<tr>
					<td><label><spring:message code="form.confirm"/></label></td>
					<td><input type="password" id="confirm" name="confirm" size="23"/></td>
				</tr>
				<tr>
					<td><label><spring:message code="form.picture"/></label></td>
					<td><input type="file" id="picture" size="11" title="<spring:message code='supporter.picture.hint'/>" name="picture"/></td>
				</tr>
				<tr>
					<td valign="top" style="padding-top:5px"><label><spring:message code="form.about"/>*</label></td>
					<td><form:textarea path="about" id="about" style="width:170px;height:90px"/></td>
				</tr>
				<tr><td colspan="2" style="padding-left: 185px;"><input name="submit" type="submit" value="<spring:message code='register.button'/>"/></td></tr>
				<tr><td colspan="2"><div id="line" style="width: 260px"></div></td></tr>			
				<tr><td colspan="2"><span class="footnote">(*) - <spring:message code="fields.optional"/></span></td></tr>
			</table>
						
			
			
		</form:form>
	</div>
	
</div>